<?php
/**
 * The page where we set the parameters for the page
 * that generates the HTML for the CSS layouts site.
 *
 * @copyright RFI, 2008-02-08
 */

require_once $_SERVER['DOCUMENT_ROOT'] . '/set-current-values.inc.php';

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>RFI's CSS Layout Generator</title>
	</head>
	<body>
		<div id="header">
			<h1>RFI's CSS Layout Generator</h1>
		</div>
		<div id="explanation">
			<p>
				Please try altering the values in the form an see how it
				affects the layout of a page.
			</p>
			<p>
				Please ensure that cookies are enabled for all the features of this
				site to work correctly.
			</p>
		</div>
		<div id="layout_configuration">
			<form
				name="layout_configuration"
				method="GET"
				action="/layout.php"
			>
				<legend>Layout Configuration</legend>
				<fieldset>
					<ul>
						<li>
							<label for="navigation_before_content">Navigation before Content:</label>
							<select name="navigation_before_content">
								<option value="1">Yes</option>
								<option value="0"<?php if ($current_values['navigation_before_content'] == 0) { echo ' selected="selected"'; } ?>>No</option>
							</select>
						</li>
					</ul>
				</fieldset>
				<fieldset>
					<ul>
						<li>
							<label for="content_float">Content float:</label>
							<select name="content_float">
								<option>none</option>
								<option<?php if ($current_values['content_float'] == 'left') { echo ' selected="selected"'; } ?>>left</option>
								<option<?php if ($current_values['content_float'] == 'right') { echo ' selected="selected"'; } ?>>right</option>
							</select>
						</li>
						<li>
							<label for="content_clear">Content clear:</label>
							<select name="content_clear">
								<option>none</option>
								<option<?php if ($current_values['content_clear'] == 'left') { echo ' selected="selected"'; } ?>>left</option>
								<option<?php if ($current_values['content_clear'] == 'right') { echo ' selected="selected"'; } ?>>right</option>
								<option<?php if ($current_values['content_clear'] == 'both') { echo ' selected="selected"'; } ?>>both</option>
							</select>
						</li>
						<li>
							<label for="content_width">Content width:</label>
							<input
								name="content_width"
								type="text"
								value="<?php echo $current_values['content_width']; ?>"
							/>
						</li>
						<li>
							<label for="content_height">Content height:</label>
							<input
								name="content_height"
								type="text"
								value="<?php echo $current_values['content_height']; ?>"
							/>
						</li>
						<li>
							<label for="content_paragraphs">Content paragraphs:</label>
							<input
								name="content_paragraphs"
								type="text"
								value="<?php echo $current_values['content_paragraphs']; ?>"
							/>
						</li>
					</ul>
				</fieldset>
				<fieldset>
					<ul>
						<li>
							<label for="navigation_float">Navigation float:</label>
							<select name="navigation_float">
								<option>none</option>
								<option<?php if ($current_values['navigation_float'] == 'left') { echo ' selected="selected"'; } ?>>left</option>
								<option<?php if ($current_values['navigation_float'] == 'right') { echo ' selected="selected"'; } ?>>right</option>
							</select>
						</li>
						<li>
							<label for="navigation_clear">Navigation clear:</label>
							<select name="navigation_clear">
								<option>none</option>
								<option<?php if ($current_values['navigation_clear'] == 'left') { echo ' selected="selected"'; } ?>>left</option>
								<option<?php if ($current_values['navigation_clear'] == 'right') { echo ' selected="selected"'; } ?>>right</option>
								<option<?php if ($current_values['navigation_clear'] == 'both') { echo ' selected="selected"'; } ?>>both</option>
							</select>
						</li>
						<li>
							<label for="navigation_width">Navigation width:</label>
							<input
								name="navigation_width"
								type="text"
								value="<?php echo $current_values['navigation_width']; ?>"
							/>
						</li>
						<li>
							<label for="navigation_height">Navigation height:</label>
							<input
								name="navigation_height"
								type="text"
								value="<?php echo $current_values['navigation_height']; ?>"
							/>
						</li>
						<li>
							<label for="navigation_extra_links">Navigation extra links:</label>
							<input
								name="navigation_extra_links"
								type="text"
								value="<?php echo $current_values['navigation_extra_links']; ?>"
							/>
						</li>
					</ul>
				</fieldset>
				<input
					type="submit"
					value="Go"
				/>
			</form>
		</div>
<?php
if (
	isset($_SESSION['previous_layout_urls'])
	&&
	(count($_SESSION['previous_layout_urls']) > 0)
) {
		echo "<div id=\"previous_layouts\">\n";
		
		echo "<h2>Previous Layouts</h2>\n";
		
		$first_time = $_SESSION['previous_layout_urls'][0]['time'];
		
		$first_time = strtotime($first_time);
		
		echo "<p>Times are " . date('e', $first_time) . "</p>\n";
		
		echo "<ol>\n";
		
		foreach ($_SESSION['previous_layout_urls'] as $plu) {
			echo "<li>\n";
			
			echo '<a href="' . $plu['url'] . '">';
			
			$time = strtotime($plu['time']);
			
			echo date('H:i:s', $time);
			
			echo "</a>\n";
			
			echo "</li>\n";
		}
		
		echo "</ol>\n";
		
		echo "</div>\n";
}
?>
		<div id="footer">
			&copy; 2008 <a href="http://impey.info/">Robert Impey</a>
		</div>
		<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
		<script type="text/javascript">
		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
		document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
		</script>
		<script type="text/javascript">
		var pageTracker = _gat._getTracker("UA-1939164-3");
		pageTracker._initData();
		pageTracker._trackPageview();
		</script>
	</body>
</html>